/*    */ package dm.jdbc.driver;
/*    */ 
/*    */ import dm.jdbc.dataConvertion.Convertion;
/*    */ import dm.jdbc.dbaccess.DBError;
/*    */ import dm.jdbc.dbaccess.DmMsgSend;
/*    */ import java.sql.SQLException;
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DmFloatBinder
/*    */   extends DmBinder
/*    */ {
/*    */   public DmFloatBinder(DmdbPreparedStatement_bs pstmt)
/*    */   {
/* 15 */     super(pstmt);
/*    */   }
/*    */   
/*    */   void init()
/*    */   {
/* 20 */     this.recDType = 10;
/* 21 */     this.recPrec = 0;
/* 22 */     this.recScale = 0;
/*    */   }
/*    */   
/*    */   public int bindData(DmMsgSend msg, int irow, int icol, boolean forBatch) throws SQLException
/*    */   {
/* 27 */     float x = ((float[])this.pstmt.m_paramObjects[icol])[irow];
/* 28 */     String serverEncoding = this.pstmt.connection.getServerEncoding();
/*    */     
/* 30 */     byte[] ret = toDbBytes(x, this.destDType, this.destPrec, this.destScale, serverEncoding);
/*    */     
/* 32 */     return msg.appendBytesWithLen2(ret, 0, ret.length);
/*    */   }
/*    */   
/*    */   public static byte[] toDbBytes(float x, int destDType, int destPrec, int destScale, String serverEncoding)
/*    */     throws SQLException
/*    */   {
/* 38 */     byte[] ret = null;
/* 39 */     switch (destDType)
/*    */     {
/*    */     case 10: 
/* 42 */       ret = Convertion.floatToByteArray(x);
/* 43 */       break;
/*    */     case 3: 
/*    */     case 13: 
/* 46 */       ret = Convertion.booleanToByteArray(x != 0.0F);
/* 47 */       break;
/*    */     case 5: 
/* 49 */       ret = Convertion.byteToByteArray((byte)(int)x);
/* 50 */       break;
/*    */     case 6: 
/* 52 */       ret = Convertion.shortToByteArray((short)(int)x);
/* 53 */       break;
/*    */     case 7: 
/* 55 */       ret = Convertion.IntToByteArray((int)x);
/* 56 */       break;
/*    */     case 8: 
/* 58 */       ret = Convertion.longToByteArray(x);
/* 59 */       break;
/*    */     case 11: 
/* 61 */       ret = Convertion.doubleToByteArray(x);
/* 62 */       break;
/*    */     case 9: 
/*    */     case 24: 
/* 65 */       ret = Convertion.BigDecimalToByteArray(String.valueOf(x), destPrec, destScale);
/* 66 */       break;
/*    */     case 0: 
/*    */     case 1: 
/* 69 */       ret = Convertion.String_char_2CType(String.valueOf(x), destPrec, destDType, serverEncoding);
/* 70 */       break;
/*    */     case 2: 
/*    */     case 19: 
/* 73 */       ret = 
/* 74 */         Convertion.String_varchar_2CType(String.valueOf(x), destPrec, destDType, serverEncoding);
/* 75 */       break;
/*    */     case 4: case 12: case 14: case 15: case 16: case 17: 
/*    */     case 18: case 20: case 21: case 22: case 23: default: 
/* 78 */       DBError.throwSQLException(6007);
/*    */     }
/* 80 */     return ret;
/*    */   }
/*    */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\driver\DmFloatBinder.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */